<?php
require('../include/init.php');
require('../include/pagenavigator.php');
require('check_login.php');
$act = $_REQUEST['act'];
if ($act == 'del') {
	$c_id = $_GET['c_id'];
	$GLOBALS['db']->query("delete from kyz_customer_message where c_id='$c_id'");
	echo 1;exit();
} 
$pagesize = 20;
$page = $_GET['page'] ? $_GET['page'] : 1;
$start = ($page-1) * $pagesize;	
$message = $GLOBALS['db']->getAll("select * from kyz_customer_message order by create_time desc limit $start, $pagesize");
$total = $GLOBALS['db']->getOne("select count(*) from kyz_customer_message");
$pagenavigator = new PageNavigator(array('total' => $total, 'currentPage' => $page, 'pageSize' => $pagesize, 'pageTemplate' => "?page={page}",'url'=>''));	
$smarty->assign('pagenavigator', $pagenavigator);
$smarty->assign('message', $message);
$smarty->display('admin/customer_message_manage.html');
?>
